#include <bits/stdc++.h>
using namespace std;

class Solution {
public:
    bool canConstruct(string ransomNote, string magazine) {
        if(magazine.size() < ransomNote.size()) return false;
        int cnt[26]{0};
        for(auto& chr: ransomNote){
            --cnt[chr-'a'];
        }
        for(auto& chr: magazine){
            ++cnt[chr-'a'];
        }
        for(int i=0; i<26; ++i){
            if(cnt[i]<0) return false;
        }
        return true;
    }
};